package pl.edu.mimuw.irs.rcp.controller.handler;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;

import pl.edu.mimuw.irs.rcp.util.Logger;
import pl.edu.mimuw.irs.rcp.util.MessageCode;

public class ShowProperties extends AbstractHandler {

	public static String PROPERTIES_ID = "org.eclipse.ui.views.PropertySheet";
	
	// *** Attributes

	// *** Methods

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		try {
			HandlerUtil.getActiveWorkbenchWindow(event).getActivePage()
					.showView(PROPERTIES_ID);
		} catch (PartInitException e) {
			Logger.handle(MessageCode.VIEW_OPEN_PROBLEM, e, PROPERTIES_ID);
		}
		return null;

	}
}
